<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>微信充值</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="keywords" content="">
  <meta name="description" content="">
  {include file="public/css"}
  {include file="public/js"}
</head>
<body>

<!-- 头部开始 -->
{include file="public/header"}
<!-- 头部结束 -->

<div class="layui-main fly-marginTop fly-user-main ">

<div class="user-left-menu" style=""> 


<!-- 用户中心导航菜单 -->
{include file="public/left_menu"}
</div>
        <div class="fly-panel fly-panel-user user-right-content" pad20>

        <div class="layui-tab layui-tab-brief" lay-filter="user">
         <blockquote class="layui-elem-quote" style="border-left: 5px solid #1E9FFF;">  <img src="__STATIC__/common/images/WePayLogo.png" style="width:200px"></blockquote>

              <div class="layui-tab-content" style="text-align:center">
              <div id="pay-wxpay" >
		               <h2><span>在线充值 <span class="orange">{$order.amount}</span> 元</span></h2>
		                <div class="layui-row"  id="pay-qrcode">
							      <div >
							  
                    <img src="{:url('wxpay/createCode')}?url={$url}" class="qrcode" style="width:333px;height:333px;overflow:hidden">
                 
							   </div>
							   <img src="__STATIC__/common/images/weixin_bottom.png">
						</div>
				</div>
				<div id="pay-success" style="display:none">
				       
                       <img src="__STATIC__/common/images/wxpayLogo.png" style="width:80px;margin:50px">

                      <h2>恭喜您，充值成功</h2>
				</div>
             </div>

           </div>
           </div>
        </div>
        </div>
    
</div>

<!-- 会员底部文件 -->
{include file="public/footer"}


<script>
layui.use(['form','table','laypage','laydate'], function(){
  var form = layui.form;
  var laypage = layui.laypage; 
  var laydate = layui.laydate;
  var table = layui.table;



});


var id ="{$Request.param.orderId}";
//定时获取支付状态
 setInterval(function(){
  
    $.post("{:url('wxpay/isPay')}",{id:id},function(json){
       if(json.code ==0 ){
         $("#pay-success").show();
         $("#pay-wxpay").remove();
         setTimeout(function(){
         	  location.href="{:url('@user/index')}";
         },3000);
       
       }
    });
  },5000);


var url ="{:url('wxpay/createCode')}";
var id = "{$order.id}";
setInterval(function(){
// 加载二维码
$.post('{:url("user/wxpay/getQrcode")}',{'id':id},function(json){
  
   $(".qrcode").attr('src',url+'?url='+json.data.url);
});
},10000);

</script>

</body>
</html>
